<?PHP
function side_block_local_show(){

	global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig;
		$block = array();	

		//GET MOD CONFIG STUFF
		if (!isset($GLOBALS['xoopsModuleConfig']) || $GLOBALS['xoopsModule']->getVar('dirname') != "local_news") {
		  $modhandler = &xoops_gethandler('module');
		  $module = &$modhandler->getByDirname("local_news");
		  $config_handler = &xoops_gethandler('config');
		  $xoopsModuleConfig = &$config_handler->getConfigsByCat(0,$module->getVar('mid')); 
		  $enableSyndication = $xoopsModuleConfig['enableSyndication'];
		  $inModule = 0;
		}else {
		  $enableSyndication = $xoopsModuleConfig['enableSyndication'];
		  $inModule = 1;
		}
		//END GET MOD CONFIG STUFF
		
		
		//GET LCOAL NEWS STOIRES
		$result = $xoopsDB->query("SELECT ID, storyID, headline FROM ".$xoopsDB->prefix("local_news_stories")." WHERE expiration_date > '".mktime()."' AND publish_date < '".mktime(23,59,59,date("m"),date("d"),date("Y"))."' AND soundfile != '' ORDER BY publish_date DESC,ID DESC LIMIT ".$xoopsModuleConfig['NISL']."" ) ;
		
		if($result){
			while ( $myrow = $xoopsDB->fetchArray($result) ) {
			
					$block['headline'][] = $myrow['headline'];
					$block['ID'][] = $myrow['ID'];
					$block['storyID'][] = $myrow['storyID'];
				}		
				
				
			if(count($block) > 0){
				//convert $block array back into other type if arrat
				$tempBlock=array();
				for($i=0; $i < count($block['storyID']); $i++){
					$tempBlock[] = array("headline"=>$block['headline'][$i],"ID"=>$block['ID'][$i],"storyID"=>$block['storyID'][$i]);
				}
				$block = $tempBlock;			
				$all = array("data" => $block,"inModule" => $inModule);
				return $all;
 			}else{
			 return false;
			}
			
			
		}else{
			return false;
		}
	

}

?>